package br.ita.battlefarm.core;

public class Orientation {
	
	public Face face;
	
	public void rotateLeft(){
		switch (face) {
		case FaceUp:
			face = Face.FaceLeft;
			break;
			
		case FaceLeft:
			face = Face.FaceDown;
			break;
			
		case FaceDown:
			face = Face.FaceRight;
			break;
			
		case FaceRight:
			face = Face.FaceUp;
			break;
		}
	}
	
	public void rotateRight(){
		switch (face) {
		case FaceUp:
			face = Face.FaceRight;
			break;
			
		case FaceLeft:
			face = Face.FaceUp;
			break;
			
		case FaceDown:
			face = Face.FaceLeft;
			break;
			
		case FaceRight:
			face = Face.FaceDown;
			break;
		}
	}
	
	public static enum Face {
		FaceUp,
		FaceRight,
		FaceDown,
		FaceLeft
	}
	
	public Orientation(){
		face = Face.FaceUp;
	}
	
	public int getAngle(){
		switch (face) {
		case FaceUp:
			return 0;
			
		case FaceLeft:
			return 270;
			
		case FaceDown:
			return 180;
			
		case FaceRight:
			return 90;
		}
		return 0;
	}
}
